#include <bits/stdc++.h>
using namespace std;

class Solution
{
public:
    int main()
    {
        int n;
        cin >> n;
        int sumScore = 0;
        int minScore, maxScore;
        cin >> minScore >> maxScore;
        if (minScore > maxScore)
        {
            swap(minScore, maxScore);
        }
        for (int i = 2; i < n; ++i)
        {
            int score;
            cin >> score;
            if (score > maxScore)
            {
                sumScore += maxScore;
                maxScore = score;
            }
            else if (score < minScore)
            {
                sumScore += minScore;
                minScore = score;
            }
            else
            {
                sumScore += score;
            }
        }
        double averageScore = 1.0 * sumScore / (n - 2);
        cout << fixed << setprecision(2) << averageScore;
        return 0;
    }
};

#ifndef __LOCAL_TEST__
int main()
{
    return Solution().main();
}
#endif